# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=libgweather-4
pkgname=(libgweather-4 libgweather-4-docs)
pkgver=4.2.0
pkgrel=1
pkgdesc="Location and timezone database and weather-lookup library"
url="https://wiki.gnome.org/Projects/LibGWeather"
arch=(x86_64)
license=(LGPL)
depends=(libsoup3 geocode-glib-2 dconf libxml2)
makedepends=(gobject-introspection vala git gi-docgen meson python-gobject)
checkdepends=(python-pylint)
options=(debug)
_commit=699cfb7e114acba4e066ebda9a51e6820da3daa7  # tags/4.2.0^0
source=("git+https://gitlab.gnome.org/GNOME/libgweather.git#commit=$_commit"
        disable-metar-test.diff)
sha256sums=('SKIP'
            '42ebd95b2de37ff959a759546473985a86fa1a5488211b303a97540f2b7a8805')

pkgver() {
  cd libgweather
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libgweather

  # Disable metar test, depends on unstable online service
  git apply -3 ../disable-metar-test.diff
}

build() {
  arch-meson libgweather build -D gtk_doc=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_libgweather-4() {
  provides=(libgweather-4.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_libgweather-4-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 et:
